home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / MATHERR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  408 b   |  24 lines

  1. /* matherr.c from page 227 */
  2. /* Use /NOE option with linker to use our copy of
  3. * matherr error handler without complaining
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <math.h>
  8. #include <string.h>
  9. main(int argc, char **argv)
  10. {
  11.     double result;
  12.     if(argc < 2)
  13.  
  14.         printf("Usage: %s <value>\n", argv[0]);
  15.  
  16.     else
  17.     {
  18.         result = sqrt(atof(argv[1]));
  19.         printf("sqrt (%s) = %f\n", argv[1], result);
  20.     }
  21. }
  22.  
  23.  
  24.